package com.then.architecture.vo;

import android.databinding.BaseObservable;
import android.databinding.Observable;
import android.databinding.ObservableArrayList;
import android.databinding.ObservableField;
import android.databinding.ObservableList;

import com.then.architecture.ActionViewListener;
import com.then.architecture.view.StickyListGroup;

import me.tatarka.bindingcollectionadapter2.ItemBinding;
import me.tatarka.bindingcollectionadapter2.OnItemBind;

/**
 * Created by 42524 on 2018/2/6.
 */

public class RecyclerVo extends BaseObservable {

    public final ObservableField<ObservableList> items = new ObservableField<>();

    public final ObservableField<ItemBinding> itemBinding = new ObservableField<>();

    public final ObservableField<Integer> gridSpanCount = new ObservableField<>();

    public final ObservableField<Boolean> loadMore = new ObservableField<>(true);

    public final ObservableField<Boolean> endLoadMore = new ObservableField<>(false);

    public final ObservableField<Boolean> endRefresh = new ObservableField<>(false);

    public final ObservableField<ActionViewListener> listeners=new ObservableField<>();

    public final ObservableField<StickyListGroup> stickyListGroup=new ObservableField<>();

    public RecyclerVo(ObservableList itemsVal, int layoutId, int BRId,int listenerBRId,ActionViewListener listener) {
        itemBinding.set(ItemBinding.of(BRId, layoutId).bindExtra(listenerBRId,listener));
        items.set(itemsVal);
    }

    public RecyclerVo(int layoutId, int BRId,int listenerBRId,ActionViewListener listener) {
        itemBinding.set(ItemBinding.of(BRId, layoutId).bindExtra(listenerBRId,listener));
    }

    public RecyclerVo(ObservableList itemsVal, OnItemBind onItemBind,int listenerBRId,ActionViewListener listener) {
        itemBinding.set(ItemBinding.of(onItemBind).bindExtra(listenerBRId,listener));
        items.set(itemsVal);
    }

    public RecyclerVo(OnItemBind onItemBind,int listenerBRId,ActionViewListener listener) {
        itemBinding.set(ItemBinding.of(onItemBind).bindExtra(listenerBRId,listener));
    }



}
